Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: third_party/WebKit/Source/devtools/scripts/devtools_run/devtools_run_cli

Issue 2637113003: DevTools: dtrun CLI helper (Closed)
Patch Set: rename file Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/readme.md ('k') | third_party/WebKit/Source/devtools/scripts/devtools_run/package.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698