mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 12:25:59 +08:00
Prettier RN local-cli
Reviewed By: yungsters Differential Revision: D7962462 fbshipit-source-id: 0afe2092af8703895de91a6d1400315c3173aa6d
This commit is contained in:
committed by
Facebook Github Bot
parent
680fb50040
commit
aba4ec0c09
@@ -3,13 +3,16 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var child_process = require('child_process');
|
||||
var spawn = child_process.spawn;
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var fs = require('fs');
|
||||
|
||||
const xsel = path.join(__dirname, 'external/xsel');
|
||||
fs.chmodSync(xsel, '0755');
|
||||
@@ -18,20 +21,20 @@ fs.chmodSync(xsel, '0755');
|
||||
*/
|
||||
function copyToClipBoard(content) {
|
||||
switch (process.platform) {
|
||||
case 'darwin':
|
||||
var child = spawn('pbcopy', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
case 'win32':
|
||||
var child = spawn('clip', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
case 'linux':
|
||||
var child = spawn(xsel, ['--clipboard', '--input']);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
case 'darwin':
|
||||
var child = spawn('pbcopy', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
case 'win32':
|
||||
var child = spawn('clip', []);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
case 'linux':
|
||||
var child = spawn(xsel, ['--clipboard', '--input']);
|
||||
child.stdin.end(new Buffer(content, 'utf8'));
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user