亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標(biāo)題:
[pexpect]如何修改sendline中的字符限制
[打印本頁]
作者:
ace_fei
時(shí)間:
2012-10-18 14:52
標(biāo)題:
[pexpect]如何修改sendline中的字符限制
本帖最后由 ace_fei 于 2012-10-19 14:43 編輯
def send(self, s):
"""This sends a string to the child process. This returns the number of
bytes written. If a log file was set then the data is also written to
the log. """
time.sleep(self.delaybeforesend)
if self.logfile is not None:
self.logfile.write (s)
self.logfile.flush()
if self.logfile_send is not None:
self.logfile_send.write (s)
self.logfile_send.flush()
c = os.write(self.child_fd, s)
return c
def sendline(self, s=''):
"""This is like send(), but it adds a line feed (os.linesep). This
returns the number of bytes written. """
n = self.send(s)
n = n + self.send (os.linesep)
return n
復(fù)制代碼
昨天用pexpect到遠(yuǎn)程服務(wù)器上執(zhí)行cmd的時(shí)候失敗, 查看log發(fā)現(xiàn)是發(fā)送的cmd長度被限制在1024內(nèi), 我一開始想可能是pexpect發(fā)送導(dǎo)致的,
不過看到pexpect包中sendline最終調(diào)用的是os.write來發(fā)送命令的,os.write是沒有字?jǐn)?shù)限制的.
我又檢查了幾遍, 最后發(fā)現(xiàn)是服務(wù)器上的命令行長度做了限制, 只接收1024字符的輸入, 差點(diǎn)錯(cuò)怪pexpect了.
作者:
linux_c_py_php
時(shí)間:
2012-10-18 15:28
哪里限制了? 猜測還是有依據(jù)?
作者:
ning_lianjie
時(shí)間:
2012-10-18 15:29
輸入太多的話,能不能改成從文件中讀取?
作者:
ace_fei
時(shí)間:
2012-10-18 15:40
回復(fù)
2#
linux_c_py_php
是我弄錯(cuò), sendline沒有限制,是我的命令行有限制導(dǎo)致的.
作者:
ace_fei
時(shí)間:
2012-10-18 15:42
本帖最后由 ace_fei 于 2012-10-18 15:43 編輯
回復(fù)
3#
ning_lianjie
sorry,是我弄錯(cuò), sendline沒有限制,是我的命令行有限制導(dǎo)致的.
版主幫忙把這個(gè)帖子刪了吧,以免混淆視聽. 謝謝
作者:
ning_lianjie
時(shí)間:
2012-10-18 18:38
回復(fù)
5#
ace_fei
又非廣告貼,過程...刪了怪可惜的.可以重新編輯一下,與他人分享.
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2