-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathtest.js
57 lines (48 loc) · 1.54 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// // load the library
// var SMB2 = require('smb2');
// // create an SMB2 instance
// var smb2Client = new SMB2({
// share:'\\\\wsl$'
// // , domain:'DOMAIN'
// // , username:'username'
// // , password:'password!'
// });
// const fs = require('fs');
// fs.readdir('\\\\wsl$\\Ubuntu-20.04\\home\\leo\\chars-test', (err, items) => {
// if (err) {
// console.log('error', err);
// } else {
// items.forEach((char) => console.log(char));
// }
// });
const fs = require('fs');
const process = require('child_process')
// try {
// process.execSync('wsl.exe -d Ubuntu-22.04 -- inotifywait2')
// console.log('yo!')
// } catch(e) {
// console.log('error', e.status)
// }
// process.exec('wsl.exe -d Ubuntu-22.04 -- inotifywait -e delete -e move -e create /tmp', (error, stdout) => {
// console.log('stdout', stdout)
// console.log(error?.code === 127)
// })
try {
const child = process.spawn('c:\\windows\\system32\\wsl.exe', ['-d', 'Ubuntu-22.04', '--', 'inotifywait', '-e', 'delete', '-e', 'move', '-e', 'create', '-m', '/tmp'], {
// stdio: 'ignore'
})
child.on('error', (e) => console.log('error', e))
child.on('close', (e) => console.log('error', e))
child.stdout.on('data', (data) => {
console.log(`yo`)
})
// setTimeout(() => {
// console.log('need to kill process')
// child.kill('SIGKILL')
// }, 5000)
} catch(e) {
console.log('error creating child', e)
}
// fs.mkdir('//wsl$/Ubuntu-20.04/tmp/\"', 0777, (err) => {
// console.log('res', err);
// });