Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
9d40978a
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
9d40978a
编写于
12月 17, 2014
作者:
R
Rudá Moura
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #314 from lmr/aexpect-tmpdir-fix
avocado.aexpect: Don't use a predictable, non system wide tmp dir
上级
5150fe9d
6b47de3d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
17 deletion
+10
-17
avocado/aexpect.py
avocado/aexpect.py
+10
-17
未找到文件。
avocado/aexpect.py
浏览文件 @
9d40978a
...
...
@@ -15,15 +15,11 @@ import tempfile
import
logging
import
shutil
BASE_DIR
=
os
.
path
.
join
(
'/tmp'
,
'aexpect'
)
def
clean_tmp_files
():
"""
Remove all aexpect temporary files.
"""
if
os
.
path
.
isdir
(
BASE_DIR
):
shutil
.
rmtree
(
BASE_DIR
,
ignore_errors
=
True
)
BASE_DIR
=
os
.
environ
.
get
(
'TMPDIR'
,
'/tmp'
)
# If you want to debug problems with your aexpect instances, setting
# DEBUG = True will leave the temporary files created by aexpect around
# so you can look at them.
DEBUG
=
False
# The following helper functions are shared by the server and the client.
...
...
@@ -88,14 +84,14 @@ def _makestandard(shell_fd, echo):
def
_get_filenames
(
base_dir
,
a_id
):
return
[
os
.
path
.
join
(
base_dir
,
a_id
,
s
)
for
s
in
return
[
os
.
path
.
join
(
base_dir
,
'aexpect_%s'
%
a_id
,
s
)
for
s
in
"shell-pid"
,
"status"
,
"output"
,
"inpipe"
,
"ctrlpipe"
,
"lock-server-running"
,
"lock-client-starting"
,
"server-log"
]
def
_get_reader_filename
(
base_dir
,
a_id
,
reader
):
return
os
.
path
.
join
(
base_dir
,
a_id
,
"outpipe-%s"
%
reader
)
return
os
.
path
.
join
(
base_dir
,
'aexpect_%s'
%
a_id
,
"outpipe-%s"
%
reader
)
# The following is the server part of the module.
...
...
@@ -527,7 +523,7 @@ class Spawn(object):
self
.
a_id
=
a_id
or
data_factory
.
generate_random_string
(
8
)
self
.
log_file
=
None
base_dir
=
os
.
path
.
join
(
BASE_DIR
,
self
.
a_id
)
base_dir
=
os
.
path
.
join
(
BASE_DIR
,
'aexpect_%s'
%
self
.
a_id
)
# Define filenames for communication with server
try
:
...
...
@@ -751,11 +747,8 @@ class Spawn(object):
self
.
_close_reader_fds
()
self
.
reader_fds
=
{}
# Remove all used files
for
filename
in
(
_get_filenames
(
BASE_DIR
,
self
.
a_id
)):
try
:
os
.
unlink
(
filename
)
except
OSError
:
pass
if
not
DEBUG
:
shutil
.
rmtree
(
os
.
path
.
join
(
BASE_DIR
,
'aexpect_%s'
%
self
.
a_id
))
def
set_linesep
(
self
,
linesep
):
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录