上一篇,找到了查看未读邮件个数方法,需要用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的更多相关文章

  1. Docker Quickstart Terminal: exit status 255 解决办法

    原文地址:https://www.jianshu.com/p/061f1ae69937 初识docker,还有先拿Windows 7 尝试下,官方提供了docker toolbox,下载后一键安装,桌 ...

  2. powershell 设置环境变量 -- go 单元测试 exit status 3221225781

    执行单元测试时出错 go test -run TestImage 错误提示如下: exit status 3221225781 这个错误的意思是需要加载对应的库文件找不到,加载对应的库文件就习. 但是 ...

  3. jenkins Exec exit status not zero. Status [-1]

    jenkins是使用ssh连接服务器后,如果使用grep获取进程并kill时,会jenkins Exec exit status not zero. Status [-1],解决办法:在获取进程时,使 ...

  4. 交叉编译:cannot find /lib/libc.so.6 collect2: ld returned 1 exit status

    1.有时候明明指定了交叉编译的动态库搜索路径,但有些库提示还是搜索不到,而且提示的搜索路径有点奇怪,不是指定的路径,比如: /opt/mips-4.4/bin/../lib/gcc/mips-linu ...

  5. 词云:解决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 ...

  6. pip安装模块时:error: command 'gcc' failed with exit status 1

    用安装python模块出现error: command 'gcc' failed with exit status 1 问题: gcc编译缺少模块 解决方法: yum install gcc libf ...

  7. gcc/g++ 编译时出现:“对’xxxx’未定义的引用,collect2: error: ld returned 1 exit status” 的错误

    出现的问题: 在使用 make 编译实现一个程序时,出现了下面的错误.查看程序源文件所在的目录时发现程序已经完成了编译,并生成了 list_repo.o 的文件,说明是在程序链接生成可执行文件时发生了 ...

  8. command 'x86_64-linux-gnu-gcc' failed with exit status 1错误及解决方案

    Ubuntu16.04安装Scrapy(pip install Scrapy)时提示错误如下: Failed building wheel for cryptography Running setup ...

  9. error: command 'cc' failed with exit status 1

    报错: Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/ ...

随机推荐

  1. [抄]OKR

    OKR是Objective Key Result KPI是KeyPointIndicator OKR概览 OKR是一个目标管理工具.即目标与关键成果法,是一套明确和跟踪目标及其完成情况的管理工具和方法 ...

  2. Weex开发之路(1):开发环境搭建

    一.Weex介绍 Weex是阿里巴巴在2016年6月份对外开源的一款移动端跨平台的移动开发工具,Weex的出现让我们的应用既有了Native的性能和H5的动态性,只要通过前端JS语法就能写出同时兼容i ...

  3. HDU 4540 威威猫系列故事——打地鼠 (状态压缩DP)

    威威猫系列故事——打地鼠 Time Limit: 300/100 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total ...

  4. 【SqlServer】SQL Server的常用函数

    字符串函数 SubString():用于截取指定字符串的方法.该方法有三个参数:参数1:用于指定要操作的字符串.参数2:用于指定要截取的字符串的起始位置,起始值为 1 .参数3:用于指定要截取的长度. ...

  5. 【java】详解集合

    目录结构: contents structure [-] 集合概述 什么是集合 Collection和Map的区别 List和Set的区别 ArrayList和LinkedList的区别 HashSe ...

  6. NoSQL 非关系数据库

    NoSQL 数据库的学习 Redis的Windows版本安装 待整理 redis 安装 关于分布式的网站介绍 NOSQL 几个网页 认识MongoDB Mongodb实现副本集和Mongodb副本集的 ...

  7. CListCtrl自适应宽度

    原文链接: http://blog.csdn.net/benny5609/article/details/1967084 void CListCtrlExDlg::AdjustColumnWidth( ...

  8. STM8的数据@near @tiny定义

    总是记不住这个:stm8 stvd下 near等于51的xdata tiny等于51的idata http://www.waveshare.net/article/STM8-3-1-10.htm 如何 ...

  9. [转]Greenplum的工作负载及资源管理

    工作负载及资源管理 查询分析-查看EXPLAIN输出 EXPLAIN输出一个计划为节点组成的树 每个节点表示一个独立的操作 计划应该从下向上读,每个节点得到的记录向上传递 成本评估项: cost - ...

  10. YMP运行初始化步骤

    , Version.VersionType.Release); private static final Log _LOG = LogFactory.getLog(YMP.class); privat ...