The following code snippet demonstrates poor error message handling:
$ # assume that fake1, fake2, and fake3 do not exist
$ cat test.js
require('shelljs/global');
ls('fake1', 'fake2', 'fake3');
$ shjs test.js
ls: no such file or directory: fake1
ls: no such file or directory: fake1
ls: no such file or directory: fake2
ls: no such file or directory: fake1
ls: no such file or directory: fake2
ls: no such file or directory: fake3
As you can see, the error message is concatenated and re-printed each time. I think the cleaner behavior is to concatenate and only print when the command exits.
The following code snippet demonstrates poor error message handling:
As you can see, the error message is concatenated and re-printed each time. I think the cleaner behavior is to concatenate and only print when the command exits.