microsoft / microsoft/PowerToys
[Awake] No command line output is given when using the `--use-parent-pid` or `--pid` arguments
- Dominant language
- C
- Stars
- 139k
- Forks
- 8.6k
- PR merge metrics
- PR metrics pending
Description
### Microsoft PowerToys version
0.98
### Installation method
Dev build in Visual Studio
### Area(s) with issue?
Awake
### Steps to reproduce
Three cases:
1. Start Awake via the command line, using the `--use-parent-pid` option:
```powershell
.\PowerToys.Awake.exe --use-parent-pid
```
2. Start Awake via the command line, using the `--pid` option with a PID which parses correctly but does not match a currently-running process:
```powershell
.\PowerToys.Awake.exe --pid 999999
```
3. Start Awake via the command line, using the `--pid` option with a PID value which matches a currently-running process:
```powershell
.\PowerToys.Awake.exe --pid
```
### ✔️ Expected Behavior
1. The current shell process is tracked by Awake. Awake will close when that process ends. A message is shown in the shell to confirm this has happened, and this includes reference to the parent PID, e.g.: `Awake started, linked to parent process 12345. Awake will exit when process 12345 ends.`
2. Awake exits because it could not find a process with that PID. A message is shown in the shell to confirm what happened, e.g. `A process with ID 999999 could not be found. Exiting...`.
3. Awake starts tracking the process with the supplied PID. A confirmation message is shown in the shell, which reiterates the supplied PID, similar to 1. For example: `Awake started, linked to process 54321. Awake will exit when process 54321 ends.`
For 1 and 3 above, Awake should also output information about any other arguments, either those supplied by the user or the defaults. It should also output information if it is superseding a running Awake instance. For example:
```
Cancelling existing Awake instance... Done.
Awake started, linked to parent process 12345. Awake will exit when process 12345 ends.
The display will be kept on.
```
### ❌ Actual Behavior
No output is sent to the shell for any of the above options. On the command line, a successful start appears identical to a failure.
The user must figure out for themselves that, on successful start, Awake will add an icon to the system tray, and that the absence of the icon indicates failure.
For failures, they must be aware that they should check the log to see what caused the issue. The log file is stored in a different location to Awake's CLI executable.
If the user wants to exit after a successful start of Awake, and they need the Process ID (as they have multiple shells open perhaps), they must know that this is only revealed in the hover text on the system tray icon:
All the above behaviour is currently undocumented.
### Upload Bug Report ZIP-file
_No response_
### Additional Information
See #46281 for the originating user discussion.
### Other Software
_No response_
Contributor guide
Research direction
Start by locating Awake's command-line handling for the --use-parent-pid and --pid arguments, then run the three PowerShell commands in the issue to observe current behavior. Done means successful starts, invalid PIDs, and any existing-instance replacement produce the described shell output, including the relevant process and Awake status information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli, desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100