| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env node |
| 2 |
| 3 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 // Use of this source code is governed by a BSD-style license that can be |
| 5 // found in the LICENSE file. |
| 6 |
| 7 var childProcess = require('child_process'); |
| 8 var fs = require('fs'); |
| 9 var path = require('path'); |
| 10 var shell = require('child_process').execSync; |
| 11 |
| 12 var repoRootPath; |
| 13 try { |
| 14 repoRootPath = shellOutput('git rev-parse --show-toplevel'); |
| 15 } catch (error) { |
| 16 console.log('ERROR: cannot use dtrun outside of chromium repo'); |
| 17 process.exit(1); |
| 18 } |
| 19 |
| 20 var devtoolsPath = path.join(repoRootPath, 'third_party', 'WebKit', 'Source', 'd
evtools'); |
| 21 |
| 22 if (!isDir(devtoolsPath)) { |
| 23 console.log('ERROR: cannot use dtrun outside of chromium repo'); |
| 24 process.exit(1); |
| 25 } |
| 26 |
| 27 var npmPath = shellOutput('which npm'); |
| 28 var args = ['run']; |
| 29 if (process.argv.length > 2) { |
| 30 args.push(process.argv[2]); |
| 31 args.push('--'); |
| 32 args = args.concat(process.argv.slice(3)); |
| 33 } |
| 34 var child = childProcess.spawn(npmPath, args, { |
| 35 cwd: devtoolsPath, |
| 36 stdio: 'inherit', |
| 37 }); |
| 38 |
| 39 function shellOutput(command) { |
| 40 return shell(command).toString().trim(); |
| 41 } |
| 42 |
| 43 function isDir(path) { |
| 44 try { |
| 45 return fs.statSync(path).isDirectory(); |
| 46 } catch (error) { |
| 47 return false; |
| 48 } |
| 49 } |
| OLD | NEW |