Skip to content

Commit ad47b30

Browse files
rolandszokesolkimicreb
authored andcommitted
ci(examples): show logs and errors of nohup process
1 parent beb74a8 commit ad47b30

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ logs
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7+
nohup.out
78

89
# Runtime data
910
pids

scripts/startExample.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,26 @@ exec('npm link react-easy-state', {
7777

7878
// 3. START EXAMPLE
7979
console.customInfo(`Starting ${process.argv[2]} in the background.`);
80-
exec("nohup bash -c 'npm run start' >/dev/null 2>&1 &", {
81-
cwd: exampleFolder,
82-
stdio: 'inherit',
83-
});
80+
exec(
81+
"nohup bash -c 'npm run start' 2>&1 > nohup.out & tail -f nohup.out &",
82+
{
83+
cwd: exampleFolder,
84+
stdio: 'inherit',
85+
},
86+
);
8487

8588
const gracefullShutdown = () => {
8689
console.customInfo('Killing nodes.');
8790
exec('killall node', { stdio: 'inherit' });
91+
exec('rm nohup.out', {
92+
cwd: exampleFolder,
93+
stdio: 'inherit',
94+
});
8895
console.customInfo('Unlinking react-easy-state.');
8996
exec('npm unlink --no-save react-easy-state', {
9097
cwd: exampleFolder,
9198
stdio: 'inherit',
9299
});
93-
exec('npm unlink', { stdio: 'inherit' });
94100
console.customInfo('Stoping bundle builder.');
95101
watcher.close();
96102
};

0 commit comments

Comments
 (0)