-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsqllint.js
36 lines (30 loc) · 1.01 KB
/
tsqllint.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
#!/usr/bin/env node
const spawn = require('child_process').spawn
const os = require('os')
var args = process.argv.slice(2)
if (os.type() === 'Darwin') {
var child = spawn(`${__dirname}/assemblies/osx-x64/TSQLLint`, args)
} else if (os.type() === 'Linux') {
var child = spawn(`${__dirname}/assemblies/linux-x64/TSQLLint`, args)
} else if (os.type() === 'Windows_NT') {
if (os.type() === 'Windows_NT') {
if (process.arch === 'ia32') {
var child = spawn(`${__dirname}/assemblies/win-x86/TSQLLint.exe`, args)
} else if (process.arch === 'x64') {
var child = spawn(`${__dirname}/assemblies/win-x64/TSQLLint.exe`, args)
} else {
throw new Error(`Invalid Platform: ${os.type()}, ${process.arch}`)
}
}
} else {
throw new Error(`Invalid Platform: ${os.type()}, ${process.arch}`)
}
child.stdout.on('data', function (data) {
process.stdout.write(data)
})
child.stderr.on('data', function (data) {
process.stdout.write(data)
})
child.on('exit', function (code) {
process.exit(code);
})