Hi Roger,
Thanks for the feedback.
Runtime.exec doesn't take arg[0] as a separate parameter, so it may make
sense to not split it up in the event. For example, if plan is to
execute "hg clone url", but the user forgets to add "hg", then it will
look as if "clone" is the command, which could be confusing.
I will change the field name to 'command' to make it consistent with the
single arg form of Runtime.exec.
Regarding delimiters, I think there are two use cases. Making something
easy for humans to read and making it unambiguous for machine parsing.
Since comma, or comma space, might be part of an argument, it is still
unsafe for a parser. It would be possible to add escape sequences, but
then it would be even harder for humans to read, which I think is the
main use case. If we in the future would add support for serializing a
String[], we could add another field, i.e. commandArray, which would
work for machines without special parse logic.
There is no ProcessEnd event today, but that is something that could be
added in the future. The exit status could be useful.
Updated webrev:
http://cr.openjdk.java.net/~egahlin/8222000/
Thanks
Erik
On 2020-03-05 15:27, Roger Riggs wrote:
Hi Erik,
Would the event be more useful if the executable arg[0] was a separate
field from the arguments?
Though I exect it depends on what is later evaluating the event fields.
If all of cmdarrray is being joined, then the event field name is more
appropriately
called 'command'; similar to the single arg form of Runtime.exec and
new ProcessBuilder(...).
A small point but the joining with ' ' space has the usual problem of
trying to parse out the arguments later.
using ',' comma might be less ambiguous. (and Arrays.toString).
Otherwise, looks fine to me.
Is there already a Process exited event? Its not quite as convenient
to instrument but useful if it captures the exit status. (ProcessImpl
- Windows and Linux versions).
Roger
On 3/5/20 9:10 AM, Erik Gahlin wrote:
Hi
Could I have review of a JFR event that is emitted when a process is
started from Java.
Bug:
https://bugs.openjdk.java.net/browse/JDK-8222000
Webrev:
http://cr.openjdk.java.net/~egahlin/8222000/
Testing:
tier1,tier2 + jdk/jdk/jfr
Thanks
Erik