Skip to content

Commit bb5e0ef

Browse files
committed
Remove hack
1 parent f93038b commit bb5e0ef

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

components/command/filemanager.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@ func (fm *FileManager) CopyToRemoteFile(name string, localPath, remotePath pulum
7474

7575
func (fm *FileManager) CopyInlineFile(fileContent pulumi.StringInput, remotePath string, opts ...pulumi.ResourceOption) (pulumi.Resource, error) {
7676
// Write the content into a temporary file and get the path
77-
tempFile, err := os.CreateTemp("", filepath.Base(remotePath))
78-
if err != nil {
79-
return nil, err
80-
}
8177

82-
_ = fileContent.ToStringOutput().ApplyT(func(content string) (string, error) {
78+
localTempPath := fileContent.ToStringOutput().ApplyT(func(content string) (string, error) {
79+
tempFile, err := os.CreateTemp("", filepath.Base(remotePath))
80+
if err != nil {
81+
return "", err
82+
}
83+
8384
if err != nil {
8485
return "", err
8586
}
@@ -93,7 +94,7 @@ func (fm *FileManager) CopyInlineFile(fileContent pulumi.StringInput, remotePath
9394
return tempFilePath, nil
9495
}).(pulumi.StringInput)
9596

96-
return fm.CopyFile(remotePath, pulumi.String(tempFile.Name()), pulumi.String(remotePath), opts...)
97+
return fm.CopyFile(remotePath, localTempPath, pulumi.String(remotePath), opts...)
9798
}
9899

99100
// CopyRelativeFolder copies recursively a relative folder to a remote folder.

0 commit comments

Comments
 (0)