diff --git a/3-getting-started/3-process/1-custom-env-variables.js b/3-getting-started/3-process/1-custom-env-variables.js new file mode 100644 index 0000000..3cdd83a --- /dev/null +++ b/3-getting-started/3-process/1-custom-env-variables.js @@ -0,0 +1,6 @@ +console.log('Current user is', process.env.USER); + +console.log('\nScript executed with:'); + +console.log('VAL1 equal to:', process.env.VAL1); +console.log('VAL2 equal to:', process.env.VAL2); diff --git a/3-getting-started/3-process/2-stdio-streams.js b/3-getting-started/3-process/2-stdio-streams.js new file mode 100644 index 0000000..fae226a --- /dev/null +++ b/3-getting-started/3-process/2-stdio-streams.js @@ -0,0 +1,6 @@ +process.stdin.on('readable', () => { + const chunk = process.stdin.read(); + if (chunk !== null) { + process.stdout.write(chunk); + } +}); diff --git a/3-getting-started/3-process/3-process-exit.js b/3-getting-started/3-process/3-process-exit.js new file mode 100644 index 0000000..1996c44 --- /dev/null +++ b/3-getting-started/3-process/3-process-exit.js @@ -0,0 +1,7 @@ +setTimeout(() => process.exit(), 2000); + +process.on('exit', () => { + console.log('Process will exit now. See you later!'); +}); + +console.log('Hello!');