go exec:exit status 64
接上一篇,找到了查看未读邮件个数方法,需要用go来执行doveadm命令,于是考虑使用go exec包
但是代码写好了之后一直报错:exit status 64,意思是选项错误,但是明明所有选项都是ok的,那么只可能是我使用go exec包的方式不对,最后各种尝试,发现go exec中,命令的所有参数都需要分开填写才行。
package main import (
"bytes"
"fmt"
"log"
"os/exec"
"strings"
) func main() {
cmd := exec.Command("doveadm", "mailbox", "status", "-u", "test@example.com", "-t", "unseen" ,"INBOX")
// cmd := exec.Command("doveadm", "mailbox status -u test@example.com -t unseen INBOX") // 这种写法是不对的
cmd.Stdin = strings.NewReader("some input")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
log.Fatal(err)
}
fmt.Printf("in all caps: %q\n", out.String())
}
go exec:exit status 64的更多相关文章
- Docker Quickstart Terminal: exit status 255 解决办法
原文地址:https://www.jianshu.com/p/061f1ae69937 初识docker,还有先拿Windows 7 尝试下,官方提供了docker toolbox,下载后一键安装,桌 ...
- powershell 设置环境变量 -- go 单元测试 exit status 3221225781
执行单元测试时出错 go test -run TestImage 错误提示如下: exit status 3221225781 这个错误的意思是需要加载对应的库文件找不到,加载对应的库文件就习. 但是 ...
- jenkins Exec exit status not zero. Status [-1]
jenkins是使用ssh连接服务器后,如果使用grep获取进程并kill时,会jenkins Exec exit status not zero. Status [-1],解决办法:在获取进程时,使 ...
- 交叉编译:cannot find /lib/libc.so.6 collect2: ld returned 1 exit status
1.有时候明明指定了交叉编译的动态库搜索路径,但有些库提示还是搜索不到,而且提示的搜索路径有点奇怪,不是指定的路径,比如: /opt/mips-4.4/bin/../lib/gcc/mips-linu ...
- 词云:解决pip install wordcloud安装过程中报错“error: command 'x86_64-linux-gnu-gcc' failed with exit status 1”问题
外部环境:ubuntu16.04, 64bits, 全局环境python2.7 在虚拟环境(python3.5)中执行 pip install wordcloud 时安装失败,报错: error: c ...
- pip安装模块时:error: command 'gcc' failed with exit status 1
用安装python模块出现error: command 'gcc' failed with exit status 1 问题: gcc编译缺少模块 解决方法: yum install gcc libf ...
- gcc/g++ 编译时出现:“对’xxxx’未定义的引用,collect2: error: ld returned 1 exit status” 的错误
出现的问题: 在使用 make 编译实现一个程序时,出现了下面的错误.查看程序源文件所在的目录时发现程序已经完成了编译,并生成了 list_repo.o 的文件,说明是在程序链接生成可执行文件时发生了 ...
- command 'x86_64-linux-gnu-gcc' failed with exit status 1错误及解决方案
Ubuntu16.04安装Scrapy(pip install Scrapy)时提示错误如下: Failed building wheel for cryptography Running setup ...
- error: command 'cc' failed with exit status 1
报错: Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/ ...
随机推荐
- 基于TILE-GX实现快速数据包处理框架-netlib实现分析【转】
最近在研究suricata源码,在匹配模式的时候,有tilegx mpipe mode,转载下文,了解一下. 原文地址:http://blog.csdn.net/lhl_blog/article/de ...
- nginx init 官方启动脚本
#!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # descrip ...
- 原创工具binlog2sql:从MySQL binlog得到你要的SQL
从MySQL binlog得到你要的SQL.根据不同设置,你可以得到原始SQL.回滚SQL.去除主键的INSERT SQL等. 用途 数据回滚 主从切换后数据不一致的修复 从binlog生成标准SQL ...
- 环信集成 2---基于环信Demo3.0,实现单聊功能
这几天在做环信,所以把环信相关的东西拿过来,做个系统点的东西 注意: 这里Demo集成的是带有实时语音功能的(libEaseMobClientSDK.a). 环信库是直接拖拽EaseMobSDK文件夹 ...
- Docker Dockerfile简述
原文地址:https://www.cnblogs.com/cuimiemie/p/6442677.html 作用 Dockerfile的内容是一坨可以执行的代码(或者说是指令)(docker的DSL) ...
- Easy APNs Provider 消息推送测试工具
1.Easy APNs Provider 简介 Easy APNs Provider 是一款为 iOS.Mac App 提供推送测试的小工具. App Store 下载地址 Easy APNs Pro ...
- 【web】a标签点击时跳出确认框
[web]a标签点击时跳出确认框 https://blog.csdn.net/michael_ouyang/article/details/52765575需求如下: 在跳转链接前,需要判断该用户是否 ...
- C语言中的 (void*)0 与 (void)0
前几天看到一个宏, 它大概是这样的: #define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LI ...
- npm的影武者 —— Npx
npx github:https://github.com/zkat/npx 什么是Npx?它和npm是什么关系? 如果你把NPM升级到最新版本npm@5.2.0 ,它就会安装一个新的包npx $ n ...
- Python 字符串过滤
需求: str1 = " """<div class="m_wrap clearfix"><ul class=" ...