forked from aws/aws-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request aws#51 from kyleknap/special-files
Add support for downloading to special files
- Loading branch information
Showing
8 changed files
with
225 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"category": "Download", | ||
"type": "bugfix", | ||
"description": "Add support for downloading to special UNIX file by name" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You | ||
# may not use this file except in compliance with the License. A copy of | ||
# the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
import os | ||
import shutil | ||
import stat | ||
import socket | ||
import tempfile | ||
|
||
from tests import unittest | ||
from tests import skip_if_windows | ||
from s3transfer.utils import OSUtils | ||
|
||
|
||
@skip_if_windows('Windows does not support UNIX special files') | ||
class TestOSUtilsSpecialFiles(unittest.TestCase): | ||
def setUp(self): | ||
self.tempdir = tempfile.mkdtemp() | ||
self.filename = os.path.join(self.tempdir, 'myfile') | ||
|
||
def tearDown(self): | ||
shutil.rmtree(self.tempdir) | ||
|
||
def test_character_device(self): | ||
self.assertTrue(OSUtils().is_special_file('/dev/null')) | ||
|
||
def test_fifo(self): | ||
os.mkfifo(self.filename) | ||
self.assertTrue(OSUtils().is_special_file(self.filename)) | ||
|
||
def test_socket(self): | ||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | ||
sock.bind(self.filename) | ||
self.assertTrue(OSUtils().is_special_file(self.filename)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.