标签: epipe

Android:写入失败:EPIPE(Broken pipe)写入文件出错

我试图以编程方式截取Android屏幕截图.我做了以下代码:

private void getsnap(){
    try{
        Process sh = Runtime.getRuntime().exec("su", null, null);
        OutputStream os = sh.getOutputStream();
        String filePath = this.getFilesDir().getPath().toString() + "/fileName1.jpeg";
        os.write(("/system/bin/screencap -p " + filePath).getBytes("ASCII"));
        os.flush();
        os.close();
        sh.waitFor();       
    } 
    catch (Exception e) 
    {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

java.io.IOException: write failed: EPIPE (Broken pipe)

请有人帮忙吗?我已经检查过其他帖子,但我找不到解决问题的方法.


编辑:

请注意,错误发生在行中os.write().

android outputstream file epipe android-permissions

18
推荐指数
1
解决办法
3万
查看次数

错误:使用node.js和imagemagick编写EPIPE

我迷失了这个错误的来源,我希望你能帮助我.我是节点的新手,我正在尝试使用imagemagick调整图像大小:

var express = require('express'), 
fs = require('fs'),
gm = require('gm'),
imagemagick = require('imagemagick'),
var gm = require('gm').subClass({ imageMagick: true });
var app = express();


app.get('/', function (req, res) {
    console.log(__dirname + "/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg");
    imagemagick.resize({
           srcData: fs.readFileSync(__dirname + "/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg", 'binary'),
           width: "400"
    }, function(err,stdout,stderr){
           if (err) console.log(err);
           fs.writeFile(__dirname + "/public/photos/thumbnail/4af1e720-a662-11e3-952c-61812ab60f67.jpg", stdout, 'binary');
    });
});
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

我已经检查过文件夹缩略图/存在,并且图像存在.你知道还有什么可以发生吗?

/Users/ik/Dropbox/snapgram/public/photos/4af1e720-a662-11e3-952c-61812ab60f67.jpg

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: write EPIPE
    at errnoException (net.js:904:11)
    at Object.afterWrite (net.js:720:19)
computername:snapgram ik$ 
Run Code Online (Sandbox Code Playgroud)

javascript imagemagick node.js express epipe

12
推荐指数
1
解决办法
8269
查看次数

过滤掉损坏的管道错误

我正在接到error一个io.Copy电话,我已经通过一个socket(TCPConn)作为目的地.预计远程主机只有在足够的时候才会断开连接,而我却没有收到任何连接.

发生丢弃时,我收到此错误:

write tcp 192.168.26.5:21277: broken pipe
Run Code Online (Sandbox Code Playgroud)

但我所拥有的只是一个error界面.如何区分破损的管道错误与其他类型的错误?

if err.Errno == EPIPE...
Run Code Online (Sandbox Code Playgroud)

io broken-pipe system-calls go epipe

10
推荐指数
2
解决办法
5118
查看次数

NodeJS - 如何在不缓冲的情况下流请求主体

在下面的代码中,我无法弄清楚为什么req.pipe(res)不起作用,但是也没有抛出错误.预感告诉我这是由于nodejs的异步行为,但这是一个非常简单的情况,没有回调.

我错过了什么?

http.createServer(function (req, res) {

  res.writeHead(200, { 'Content-Type': 'text/plain' });

  res.write('Echo service: \nUrl:  ' + req.url);
  res.write('\nHeaders:\n' + JSON.stringify(req.headers, true, 2));

  res.write('\nBody:\n'); 

  req.pipe(res); // does not work

  res.end();

}).listen(8000);
Run Code Online (Sandbox Code Playgroud)

这是卷曲:

?  ldap-auth-gateway git:(master) ? curl -v -X POST --data "test.payload" --header "Cookie:  token=12345678" --header "Content-Type:text/plain" localhost:9002 
Run Code Online (Sandbox Code Playgroud)

这是调试输出(请参阅上传的主体):

  About to connect() to localhost port 9002 (#0)
  Trying 127.0.0.1...
    connected
    Connected to localhost (127.0.0.1) port 9002 (#0)
  POST / HTTP/1.1
  User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
  Host: localhost:9002
  Accept: */*
  Cookie: …
Run Code Online (Sandbox Code Playgroud)

http pipe stream node.js epipe

9
推荐指数
2
解决办法
2万
查看次数

错误:写 EPIPE

我不断收到以下错误:

Error: write EPIPE
at errnoException (net.js:901:11)
at Object.afterWrite (net.js:718:19)
Run Code Online (Sandbox Code Playgroud)

当我运行以下函数时:

    router.route('/certificationService')
    .post(function (req, res) {
        var html = null,
            certificate = req.body.certificate,
            lang = req.body.lang,
            now = new Date(),
            dd = now.getDate(),
            mm = now.getMonth() + 1,
            yyyy = now.getFullYear();

        if (dd < 10) dd = '0' + dd;
        if (mm < 10) mm = '0' + mm;

        switch (lang) {
            case 'da':
                var text = {
                    title: 'Certifikat',
                    first_line: 'Dette certifikat er givet til',
                    second_line: 'for gennemførelsen af …
Run Code Online (Sandbox Code Playgroud)

javascript node.js epipe

6
推荐指数
1
解决办法
2万
查看次数

Node.js - events.js:154 throw err write EPIPE; 程序崩溃

试图运行我的 Node.js 程序,它已经运行了很长时间,现在突然……不行了。我正在尝试找出问题所在,并且我认为如果我在此处发布以尝试对其进行追踪会有所帮助。这是日志输出:

events.js:154
    throw er; // Unhandled 'error' event
    ^

Error: write EPIPE
    at exports._errnoException (util.js:856:11)
    at WriteWrap.afterWrite (net.js:767:14)
Run Code Online (Sandbox Code Playgroud)

坦率地说,我不知道为什么它会抛出 EPIPE 错误,我已经检查过没有任何可能干扰的运行,并且它在与以前完全相同的 shell 中运行。如果有什么我应该添加的,请告诉我。

javascript node.js epipe

6
推荐指数
1
解决办法
2万
查看次数

Node.js 中的 EPIPE 错误

以下代码在 JPEG、Docx、zip 和其他几种文件格式上运行良好。然后我尝试在 mpg-filer 上,但是,我遇到了无法调试的“错误:写入 EPIPE”。使用 try/catch 结构也会导致未捕获的异常。

编码:

var fs = require('fs')
const { spawn } = require('child_process')
var file = '/path/to/some/file.jpg'

var rs = fs.createReadStream(file)
const exiftool = spawn('exiftool', ['-json', '-']);
var exif = ''

exiftool.stdout.on('data', function(chunk) {
    exif += chunk
})

exiftool.on('close', function(code) {
    console.log('Sourcefile: %s', JSON.parse(exif)[0].SourceFile)
})

exiftool.on('error', function(error) {
    console.log('exiftool has error: %s', error)
})

rs.pipe(exiftool.stdin)
Run Code Online (Sandbox Code Playgroud)

使用 mpg 文件时的错误:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.afterWrite [as oncomplete] (net.js:835:14) …
Run Code Online (Sandbox Code Playgroud)

child-process node.js epipe

6
推荐指数
1
解决办法
2万
查看次数

child_process.spawn 上的 node.js EPIPE 异常

我正在使用,node.js v0.6.10尽管我在0.6.7. 基本上我运行一个子进程使用spawn启动另一个node.js的过程,并通过连通stdoutstdin 这里有两个脚本:

父 ( cli.js) :

var spawn = require("child_process").spawn;

var doSpawn = function(callback){
  var child = spawn('child.js');

  child.on('exit', function(code){
    console.log("Child exited with code " + code);
  });

  child.stdin.write("ping");
  child.stdin.end();
};


doSpawn();

setTimeout(function(){}, 10000);
Run Code Online (Sandbox Code Playgroud)

child.js

var run = function(){
  process.stdout.on('drain', function(){
    process.exit(0);
  });

  process.stdout.write(stdout);
};

var stdin = process.stdin;

stdin.resume();
stdin.setEncoding("utf8");

var stdout = '';

stdin.on('data', function(data){
  stdout += data;
});

stdin.on('end', run);
Run Code Online (Sandbox Code Playgroud)

然后当我运行时node cli.js

$ …
Run Code Online (Sandbox Code Playgroud)

spawn node.js epipe

5
推荐指数
1
解决办法
2716
查看次数

Android系统.写入失败:使用过程时EPIPE(断管)

您好我尝试通过Process在我的应用内部安装应用.对于该函数,我创建了此方法.

private void loadAndInstallApk(String string) {
    if(!isRooted()){
        return;
    }
    Uri uri = loadApk(string);
    if(uri == null){
        return;
    }
    Process p = null;
    DataOutputStream outs = null;
    try
    {

        p = Runtime.getRuntime().exec(new String[]{"su", "-c", "system/bin/sh"});
        outs=new DataOutputStream(p.getOutputStream());

        String cmd="pm install -r " + uri.getPath();
        Log.d(TAG, "DATA = cmd = " + cmd);
        outs.writeBytes(cmd + "\n");

        // Close the terminal
        outs.writeBytes("exit\n");
        outs.flush();
            p.waitFor();
            if (p.exitValue() != 255) {
                Log.d(TAG, "DATA succerss " + p.exitValue());
                // Sucess 
            }
            else {
                Log.d(TAG, "DATA Fail …
Run Code Online (Sandbox Code Playgroud)

android file epipe

5
推荐指数
1
解决办法
4764
查看次数