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__='/ ...
随机推荐
- java.lang.IllegalArgumentException: Minimum column number is 0
easyUI的datagrid导出Excel时报如下错误: [2018-06-20 15:00:21] [ERROR] [org.jeecgframework.poi.excel.export.Exc ...
- fisheye Error occurred during initialization of VM Could not reserve enough space for object heap 问题解决!
参考文章:https://answers.atlassian.com/questions/9397/not-enough-heap-space-to-run-fisheye fisheye下载好了之后 ...
- Linux中的lo回环接口详细介绍
1.linux的网络接口之扫盲 (1)网络接口的命名 这里并不存在一定的命名规范,但网络接口名字的定义一般都是要有意义的.例如: eth0: ethernet的简写,一般用于以太网接口. wifi0: ...
- 进阶之路(基础篇) - 020 放弃Arduino IDE,拥抱Sublime Text 3
本帖转载:Arduino讨论区相信大家对Arduino IDE的不能输入中文,排版不方便,没有行号,界面难看......深恶痛绝.我也是.经过vs2012,eclipse等IDE的试用,配置麻烦,ID ...
- git学习笔记(二)—— 创建版本库&&版本管理
一.创建版本库 创建一个版本库非常简单,首先,选择一个合适的地方,创建一个空目录: mkdir gitHub_CXWcd gitHub_CXW git init Initialized empty G ...
- js验证身份证类
var idCardNoUtil = { provinceAndCitys: {11:"北京",12:"天津",13:"河北",14:&qu ...
- 模拟器集成3DTouch-b
本文主要讲解3DTouch各种场景下的集成,开发主屏幕应用icon上的快捷选项标签(Home Screen Quick Actions),静态设置 UIApplicationShortcutItem ...
- VM页面中遍历枚举类
1)自定义的枚举类如下所示: public enum BusType { MID_SMALL(1, "中小件"), FRESH(2, "生鲜"), GLOBAL ...
- mysql快速移植表数据
使用select into outfile xxx , load data infile xxx 例如 : SELECT * into outfile '/tmp/out.txt' FROM `db ...
- android 一步一步教你集成tinker(热修复)
这几天闲着没事,就看了下现在比较火的热修复,确实有了热修复就解决了android native的一个很尴尬问题,之前比起h5,android在用户体验上是有优势,但是过于复杂的版本更新,使用户烦不胜烦 ...