vscode-file-watcher icon indicating copy to clipboard operation
vscode-file-watcher copied to clipboard

Node.js process triggered with watcher exits with 1 but VS code still shows Success in green

Open LINCD-admin opened this issue 3 months ago • 3 comments

Im triggering my own build tool with yarn lincd build-updated which is a little node.js program. When I have build errors the process ends with process.exit(1) however VS code still shows a green "Success" in the bottom.

Why is it not triggering "Error" state? Should I configure the watcher different or is this something that can be fixed/improved?

	"settings": {
		"filewatcher.commands": [
			{
				"match": "./packages/.*",
				"isAsync": false,//we need to wait for the build to finish before it's called again - to avoid double builds
				"cmd": "cd ${workspaceRoot} && yarn lincd build-updated",
				"event": "onFileChange"
			}
		]
	},
Image

LINCD-admin avatar Sep 21 '25 07:09 LINCD-admin

@LINCD-admin Hi! Currently, the extension only captures errors written to stderr. Checking process exit codes is not yet supported, but might be considered in the future. As a workaround, you can add console.error:

console.error('error message');
process.exit(1);

listgarten100 avatar Sep 25 '25 12:09 listgarten100

gotcha, that's helpful. Thanks!

flyon avatar Sep 26 '25 10:09 flyon

ps yes I think it would be helpful to detect process.exit(1) as an error. I've managed to fix one tool console.error but the same came up with another tool that I don't own. it's pretty common behavior to use process.exit(1)

flyon avatar Oct 01 '25 16:10 flyon