| Summary: | Calling pgrep "javafrom java process | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Brandon Barker <brandon.barker> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed Not A Bug | ||
| Severity: | Affects Only Me | CC: | jilles, ler |
| Priority: | --- | ||
| Version: | 11.0-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
Brandon Barker
2017-01-04 21:46:42 UTC
A couple of notes I accidentally left out due to premature submission:
* openjdk8 is required to be installed.
After running this in amm:
%pgrep("java")
this results in the following less than helpful error, which after looking through the ammonite code, indicates that nothing to stdout was printed from pgrep:
ammonite.ops.InteractiveShelloutException
ammonite.ops.Shellout$.executeInteractive(Shellout.scala:53)
ammonite.ops.Shellout$.$anonfun$$percent$1(Shellout.scala:14)
ammonite.ops.Shellout$.$anonfun$$percent$1$adapted(Shellout.scala:14)
ammonite.ops.Command.applyDynamic(Shellout.scala:105)
$sess.cmd22$.<init>(cmd22.sc:1)
$sess.cmd22$.<clinit>(cmd22.sc:-1)
Unless the -a option is used, pgrep and pkill do not find any ancestor processes. This is documented if you read the man page fully, but might be slightly unexpected. On the other hand, why use pgrep to find the current shell process? The commit message that added this (SVN r192242) states: "When finding processes, ignore ourself and our ancestors. It is almost always surprising when you kill a 'sh -c ...' ancestor or when you kill yourself when using -f." Aha, thanks, and sorry about that - I really should be more thorough in man page checking between systems. Adding "-a" does indeed fix the problem. I'll admit I'm curious as to why this isn't an issue when calling pgrep from other shells, like tcsh: "pgrep tcsh" from tcsh. (In reply to Brandon Barker from comment #4) I see the same behaviour with zsh: % pgrep zsh 983 968 % pgrep -a zsh 1857 983 968 % This is with three shells open and running pgrep from one of them. might it have to do with the proc title of the calling process. where -a grabs all the processes before? (just pure unadulterated conjecture) |